import * as vscode from 'vscode';
import * as path from 'path';
import * as fs from 'fs';

export function buildHAP() {
    // Check if .npmrc file exists
    let npmrcPath = path.join(vscode.workspace.rootPath || '', '.npmrc');
    if (!fs.existsSync(npmrcPath)) {
        // If not, create a new .npmrc file
        fs.writeFileSync(npmrcPath, `store-dir=C:\Users\qym20\.hvigor\caches`);
    }
    // Implement your command here
    vscode.window.showInformationMessage('Build Project command executed!');
    let terminal = vscode.window.createTerminal({
        name: 'HarmonyOS HAP Build',
        env: { PATH: process.env.PATH }
    });		terminal.sendText('./hvigorw clean assembleHap --no-daemon');
    terminal.show();
}